<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>
    function CreatePhone(id){
        this.id = id;
    }
    CreatePhone.prototype.call = function(){
        console.log(this.color + "的" + this.id + ",打电话")
    }

    function AbstractColorWhite(id){
        const p = new CreatePhone(id)
        p.color = "白色";
        return p;
    }
    function AbstractColorPink(id){
        const p = new CreatePhone(id)
        p.color = "粉色";
        return p;
    }

    const p1 = AbstractColorWhite("001");
    const p2 = AbstractColorWhite("002");
    const p3 = AbstractColorPink("001");
    const p4 = AbstractColorPink("002");

    console.log(p1);
    console.log(p2);
    console.log(p3);
    console.log(p4);

    p1.call();
    p2.call();
    p3.call();
    p4.call();

    console.log(p1.call === p2.call);
    console.log(p2.call === p3.call);
    console.log(p4.call === p3.call);
    console.log(p4.call === p1.call);

</script>
</html>